﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace ExcellentCRM.DataService.Models
{
    /// <summary>
    /// 工作计划
    /// </summary>
    public class Schedule : BaseModel
    {
        public long CreatedById { get; set; }

        public ScheduleType ScheduleType { get; set; }

        [DataType(DataType.Date)]
        public DateTime ScheduleDate { get; set; }

        public long? ParentId { get; set; }

        /// <summary>
        /// 总结
        /// </summary>
        [StringLength(1500)]
        public string Summary { get; set; }

        /// <summary>
        /// 所遇问题
        /// </summary>
        [StringLength(500)]
        public string Problem { get; set; }

        /// <summary>
        /// 收获
        /// </summary>
        [StringLength(500)]
        public string Results { get; set; }

        /// <summary>
        /// 体会
        /// </summary>
        [StringLength(500)]
        public string Experience { get; set; }

        /// <summary>
        /// 领导回复
        /// </summary>
        [StringLength(500)]
        public string Replay { get; set; }

        /// <summary>
        /// 父计划
        /// </summary>
        [ForeignKey("ParentId")]
        public virtual Schedule ParentSchedule { get; set; }

        /// <summary>
        /// 创建人
        /// </summary>
        [ForeignKey("CreatedById")]
        public virtual Staff CreatedBy { get; set; }

        /// <summary>
        /// 子计划
        /// </summary>
        public virtual IList<Schedule> ChildSchedule { get; set; }
    }

    public enum ScheduleType
    {
        None = 0,
        /// <summary>
        /// 日报
        /// </summary>
        Day = 1,
        /// <summary>
        /// 周报
        /// </summary>
        Week = 2,
        /// <summary>
        /// 月报
        /// </summary>
        Month = 3,
        /// <summary>
        /// 年度计划
        /// </summary>
        Year = 4
    }
}